package com.aaa.project.service.impl;


import com.aaa.entity.GGGoods;
import com.aaa.entity.GGoods;
import com.aaa.project.mapper.GGGoodsMapper;
import com.aaa.project.mapper.GGoodsMapper;
import com.aaa.project.service.IGGoodsService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 商品表 服务实现类
 * </p>
 *
 * @author zhangxuhui
 * @since 2023-02-06
 */
@Service
@SuppressWarnings("all")
public class GGoodsServiceImpl extends ServiceImpl<GGoodsMapper, GGoods> implements IGGoodsService {

@Autowired
private GGoodsMapper gGoodsMapper;
@Autowired
private GGGoodsMapper ggGoodsMapper;

    @Override
    public GGoods find(String code) {
        return gGoodsMapper.find(code);
    }

    @Override
    public List<Map<String,Object>> findAll(String id) {
       return gGoodsMapper.findAll(id);
    }

    @Override
    public Object findAllNum(String id) {
        return gGoodsMapper.findAllNum(id);
    }

    @Override
    public List<Map<String,Object>> findGoods( String uid,String id) {
        return gGoodsMapper.findGoods(uid,id);
    }



    @Override
    public Object jiSuan(String id) {
        return gGoodsMapper.jiSuan(id);
    }

    @Override
    public List getAllgoodsinfoBybid(Integer curr, Integer size, String bid, GGGoods gGoods) {
        Integer newcurr = curr-1;
        List goodsList = gGoodsMapper.getAllgoodsinfoBybid(newcurr,size,bid,gGoods);
        return goodsList;
    }


    @Override
    public int update(GGGoods gGoods) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("id",gGoods.getId());
        return ggGoodsMapper.update(gGoods,queryWrapper);
    }

    @Override
    public int save(GGGoods ggGoods) {
        return ggGoodsMapper.insert(ggGoods);
    }


}
